class Zcsh {

    int[] result = null;

    public NumArray(int[] nums) {
        if (nums != null && nums.length != 0) {
            result = new int[nums.length];
            result[0] = nums[0];
            for (int i = 1; i < nums.length; i++) {
                result[i] = result[i - 1] + nums[i];
            }
        }
    }
    
    public int sumRange(int i, int j) {
        if (result == null || (i & j) < 0 || j >= result.length || i > j) return 0;
        if (i == 0) return result[j];
        return result[j] - result[i - 1];
    }
}

/**
 * Your NumArray object will be instantiated and called as such:
 * NumArray obj = new NumArray(nums);
 * int param_1 = obj.sumRange(i,j);
 */